home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / asppw112 / fdinfo.asp < prev    next >
Text File  |  1999-01-07  |  3KB  |  76 lines

  1. <HTML><BODY>
  2. <%
  3.     ' GetFileInfo(ByVal vsFilePathName As String) As CFile
  4.     ' output:   CFile Object   Succeed
  5.     '           Nothing        Failure
  6.     
  7.     ' Sample Operation:
  8.     ' Get file or directory information.
  9.     ' Note: Class CFile properties:
  10.     '       Name as string
  11.     '       Length as long
  12.     '       Attr  as Integer
  13.     '       CreationTime as string
  14.     '       LastWriteTime as string
  15.     '       LastAccessTime as string
  16.     '
  17.     ' This file is provided as part of  ASP Power Widgets Samples
  18.     '
  19.     ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
  20.     ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  21.     ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  22.     ' OF MERCHANTABILITY AND/OR FITNESS FOR A  PARTICULAR
  23.     ' PURPOSE.
  24.  
  25.     ' Copyright 1997-1998. All rights reserved.
  26.     ' Dalun Software Inc. ASP Power Widgets
  27.     ' http://www.dalun.com
  28.     ' http://members.tripod.com/ActiveServerPage/
  29.       
  30.         
  31.     vbNormal    =    0    'Normal
  32.     vbReadOnly    =    1    'Read-only
  33.     vbHidden    =    2    'Hidden
  34.     vbSystem    =    4    'System
  35.     vbDirectory    =    16    'Directory or folder
  36.     vbArchive    =    32    'File has changed since last backup
  37.  
  38.     response.write "<p><h2>File/Directory Information Demo.</h2></p>"
  39.  
  40.     Set oFDMgt = Server.CreateObject("ASPPW.FDMgt")
  41.  
  42.     set oFInfo= oFDMgt.GetFileInfo ( oFDMgt.GetWindowsDirectory + "\win.ini" )
  43.     if oFInfo is Nothing then
  44.         response.write  oFDMgt.GetWindowsDirectory + "\win.ini not found.<br>"   
  45.     else
  46.         nAttr=oFInfo.attr
  47.  
  48.         if nAttr And vbReadOnly then
  49.             sAttr=sAttr & "R "
  50.         end if
  51.         if nAttr And vbHidden then
  52.             sAttr=sAttr & "H "
  53.         end if
  54.         if nAttr And vbSystem then
  55.             sAttr=sAttr & "S "
  56.         end if
  57.         if nAttr And vbArchive then
  58.              sAttr=sAttr & "A "
  59.         end if
  60.  
  61.         response.write "<font size=2 face=""Courier New"">" & oFInfo.Name & " attribute is: " & sAttr & "</font><br>"
  62.         response.write "<font size=2 face=""Courier New"">File length    : " & oFInfo.Length & " bytes. <br>"
  63.         response.write "<font size=2 face=""Courier New"">Creation   Time: " & oFInfo.CreationTime & ".<br>"
  64.         response.write "<font size=2 face=""Courier New"">LastWrite  Time: " & oFInfo.LastWriteTime & ".<br>"
  65.         response.write "<font size=2 face=""Courier New"">LastAccess Time: " & oFInfo.LastAccessTime & ".<br>"
  66.         set oFInfo = Nothing
  67.     end if
  68.  
  69.     Set oFDMgt = Nothing    
  70. %>
  71. </BODY></HTML>
  72.  
  73.  
  74.  
  75.  
  76.